<template>
  <view class="wrap">
    <uv-navbar :fixed="false" title="退出社群" autoBack safeAreaInsetTop placeholder :border='false'>
      <template v-slot:left>
        <view class="navEditName nav-left">取消</view>
      </template>
    </uv-navbar>
    <view class="status"></view>
    <view class="input">
      <uv-textarea v-model="desc" placeholder="请输入退出原因" height='300rpx' border='none'></uv-textarea>
    </view>
    <view class="content">*退群视为放弃全部权益，不予退还入群时候的费用。</view>
    <view class="foot">
      <view class="protocol">
        <protocol-box :agree='agree' :protocol="[{name: '《付款及退款规则》', id: '8'}]" @click="agree = !agree"></protocol-box>
      </view>
      <button class="btn" hover-class="none" @click="tap">提交</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import { post } from '@/api';
import { useOrder } from '@/store';
import { toast } from '@/common';
import { onLoad } from '@dcloudio/uni-app';

let desc = ref('');
let agree = ref(false);
let id = '';

onLoad((option) => {
  id = option.id;
})

function tap(){
  post('api/association/exitAssociation', { association_id: id }).then(res => {
    if(res.code == 1){
      toast('退出成功');
      setTimeout(() => {
        uni.reLaunch({
        	url: '/pages/index/index'
        });
      }, 1000)
    }
  })
}
</script>

<style lang="scss" scoped>
  .foot{
    padding: 0 30rpx;
    padding-top: 160rpx;
    .protocol{
      padding-bottom: 30rpx;
    }
  }
  .content{
    font-weight: 400;
    font-size: 28rpx;
    color: #999999;
    padding: 30rpx;
  }
  .input{
    padding: 30rpx;
    background-color: #fff;
  }
  .navEditName{
    font-weight: 400;
    font-size: 28rpx;
    &.nav-left{
      color: #737373;
    }
  }
  .status{
    width: 100%;
    height: 20rpx;
    background-color: #F5F5F5;
  }
  .wrap{
    width: 100%;
    min-height: 100vh;
    background-color: #F5F5F5;
  }
</style>